package com.yeswater.multithread.chapter1.test1_11.test6;

import org.junit.Test;

import java.util.concurrent.TimeUnit;

/**
 * author : yeswater
 * date : 2023/10/19
 *
 */

public class RunTest {

    /**
     * 调用 stop() ,线程不确定会在哪里停止,会导致数据不完整
     */
    @Test
    public void test1() {
        try {
            MyThread t1 = new MyThread();
            t1.start();
            TimeUnit.SECONDS.sleep(8);
            t1.stop();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void test2() {
        MyThread1 t1 = new MyThread1();
        t1.start();
    }

}
